GDB and VxWorks

Contents|Index|Previous|Next
GDB and VxWorks

GDB enables developers to spawn and debug tasks running on networked VxWorks targets from a Unix host. Already-running tasks spawned from the VxWorks shell can also be debugged. GDB uses code that runs on both the Unix host and on the VxWorks target. The program gdb is installed and executed on the Unix host. (It may be installed with the name, vxgdb, to distinguish it from a GDB for debugging programs on the host itself.)

VxWorks-timeoutargs

All VxWorks-based targets now support the option vxworks-timeout. This option is set by the user, and args represents the number of seconds GDB waits for responses to rpc’s. You might use this if your VxWorks target is a slow software simulator or is on the far side of a thin network line.

The following information on connecting to VxWorks was current when this documentation was produced; newer releases of VxWorks may use revised procedures.

- Connecting to VxWorks
- VxWorks download
- Running tasks

To use GDB with VxWorks, you must rebuild your VxWorks kernel to include the remote debugging interface routines in the VxWorks library ‘rdb.a’. To do this, define INCLUDE_RDB in the VxWorks configuration file ‘configAll.h’ and rebuild your VxWorks kernel. The resulting kernel contains ‘rdb.a’, and spawns the source debugging task, tRdbTask, when VxWorks is booted. For more information on configuring and remaking VxWorks, see the manufacturer’s manual. Once you have included ‘rdb.a’ in your VxWorks system image and set your Unix execution search path to find GDB, you are ready to run GDB. From your Unix host, run gdb (or vxgdb, depending on your installation). GDB comes up showing the prompt, (vxgdb).

Connecting to VxWorks

The GDB command target lets you connect to a VxWorks target on the network. To connect to a target whose host name is “tt”, type at the (vxgdb) prompt:

(vxgdb) target vxworks tt

GDB displays messages like these:

Attaching remote machine across net...
Connected to tt.

GDB then attempts to read the symbol tables of any object modules loaded into the VxWorks target since it was last booted. GDB locates these files by searching the directories listed in the command search path (see Your program’s environment); if it fails to find an object file, it displays a message such as the following example of output.

prog.o: No such file or directory.

When this happens, add the appropriate directory to the search path with the GDB command path, and execute the target command again.

VxWorks download

If you have connected to the VxWorks target and you want to debug an object that has not yet been loaded, you can use the GDB load command to download a file from Unix to VxWorks incrementally.

The object file given as an argument to the load command is actually opened twice: first by the VxWorks target in order to download the code, then by GDB in order to read the symbol table. This can lead to problems if the current working directories on the two systems differ.

If both systems have had NFS mount the same filesystems, you can avoid these problems by using absolute paths. Otherwise, it is simplest to set the working directory on both systems to the directory in which the object file resides, and then to reference the file by its name, without any path.

For instance, a program ‘prog.o’ may reside in ‘vxpath/vw/demo/rdb’ in VxWorks and in ‘hostpath/vw/demo/rdb’ on the host.

To load this program on VxWorks, type: -> cd “vxpath/vw/demo/rdb”

Then, in GDB, type the following commands at the (vxgdb)prompt:

cd hostpath/vw/demo/rdb
load prog.o

GDB displays a response similar to to the following output.

Reading symbol data from wherever/vw/demo/rdb/prog.o
...
Done.

You can also use the load command to reload an object module after editing and recompiling the corresponding source file.

Note:
This makes GDB delete all currently-defined breakpoints, auto-displays, and convenience variables, and clears the value history. (This is necessary in order to preserve the integrity of debugger data structures that reference the target system’s symbol table.)

Running tasks

You can also attach to an existing task using the `attach` command as follows.

attach task

task is the VxWorks hexadecimal task ID. The task can be running or suspended when you attach to it. Running tasks are suspended at the time of attachment.

Top|Contents|Index|Previous|Next